package org.spring.demo.filter;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

/**
 * 过滤器
 * @author 张宗朋
 * @date   2018年9月13日
 */
public class MyFilter implements Filter{

	@Override
	public void init(FilterConfig filterConfig) throws ServletException {
		System.out.println("-----Filter初始化开始-------");
		System.out.println("-----------------"+filterConfig.getFilterName());
		System.out.println("-----Filter初始化结束-------");
		
	}

	@Override
	public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
			throws IOException, ServletException {
		    System.out.println("-----Filter-开始-----");
	        chain.doFilter(request, response);
	        System.out.println("-----Filter-结束-----");
		
	}

	@Override
	public void destroy() {
		System.out.println("-----Filter注销-------");
		
	}

}
